/* ExampleApplicationPlugin.vala
 *
 * Copyright (C) 2008  Raphael Bosshard
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 *
 * Author:
 * 	Raphael Bosshard <raphael.bosshard@gmail.com>
 */

using GLib;
using Gtk;

public class ExampleApplication.Plugin : ExampleApplication.IPlugin {
	Button button;
	Window window;


	construct  {
		GLib.message ("Creating plugin object");
		this.button = new Button.with_label ("Set title");

	}	

	public override void activate (Core core) {
		GLib.message ("Activating plugin...");
		
		
		this.window = core.get_main_window ();
		this.window.destroy += Gtk.main_quit;
		
		this.button.clicked += this.set_window_title;
		this.window.add (this.button);	
		
		this.window.show_all ();

	}

	public override void deactivate () {
		GLib.message ("Deactivating plugin...");
	}
	
	public void set_window_title (Button b) {
		window.title = this.button.label;
	}
	
}

[ModuleInit]
public GLib.Type plugin_register () {

	GLib.message ("Registering plugin ");

	return typeof (ExampleApplication.Plugin);
}


